package dacp.etl.kafka.hdfs.process.impl;

import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

import com.google.common.base.Objects;

import dacp.etl.kafka.hdfs.process.Processor;

public class TimeProcessor implements Processor{
	private DateTimeFormatter datefmtter;
	private String datefmtterS;
	
	public TimeProcessor(String datefmtter){
		this.datefmtterS = datefmtter;
		this.datefmtter = DateTimeFormat.forPattern(datefmtter);
	}
	
	@Override
	public String process(String ori) {
		return new DateTime(Long.parseLong(ori)).toString(datefmtter);
	}
	
	@Override
	public String toString(){
		return Objects.toStringHelper(this).add("datefmtterS",datefmtterS).toString();
	}
}